package com.tedu.bank_ems1.controller;

import com.tedu.bank_ems1.entity.Emp;
import com.tedu.bank_ems1.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Author：毕龙
 * Date: 2024/6/27 9:26
 */
@WebServlet("/emp/getEmp")
public class GetEmpServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        Integer idData = Integer.valueOf(id);
        EmpServiceImpl service = new EmpServiceImpl();
        Emp emp = service.getEmp(idData);
        req.setAttribute("emp",emp);
        req.getRequestDispatcher("/ems/emp/updateEmp.jsp").forward(req,resp);


    }
}
